class Solution334 {
    public boolean increasingTriplet(int[] nums) {
        int len = nums.length ;
        int[] dp = new int[3] ; 
        dp[0] = dp[1] = dp[2] = Integer.MAX_VALUE ;
        int maxLen = 0 ; 
        for(int i=0 ; i < len && maxLen < 3 ; i ++){
            if(nums[i] < dp[0]){
                dp[0] = nums[i];
                maxLen=1 ;
            }else if(nums[i] > dp[0]){
                if(nums[i] < dp[1]){
                    dp[1] = nums[i] ;
                    maxLen = 2 ; 
                }else if(nums[i] > dp[1]){
                    dp[2] = nums[i] ;
                    maxLen = 3 ;
                }
            }
        }
        return maxLen==3 ; 
    }
}